import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Login from '../views/LoginPage.vue'
import HomePage from '../views/HomePage.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/home',
    name: 'home',
    component: () => import(/* webpackChunkName: "home" */ '../views/HomePage.vue'),
    meta: { requiresAuth: true },
    children: [
      {
        path:'/user/contentpage',
        name:'contentpage',
        component : () => import(/* webpackChunkName: "contentpage" */ '../views/homeView/ContentPage.vue')
      },
      {
        path:'/user/role-manger',
        name:'role-manger',
        component: () => import(/* webpackChunkName: "role-manger" */ '../views/user/role-manger.vue')
      },
      {
        path:'/user/authority-manger',
        name:'authority-manger',
        component: () => import(/* webpackChunkName: "authority-manger" */ '../views/user/authority-manger.vue')
      },
      {
        path:'/contract/ExpenditureContract',
        name:'expenditure-contract',
        component: () => import(/* webpackChunkName: "expenditure-contract" */ '../views/contract/ExpenditureContract.vue')
      },
      {
        path:'/contract/RevenueContract',
        name:'revenue-contract',
        component: () => import(/* webpackChunkName: "revenue-contract" */ '../views/contract/RevenueContract.vue')
      }
    ]
  },
  {
    path: '/register',
    name: 'register',
    component: () => import(/* webpackChunkName: "register" */ '../views/RegisterPage.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
